.bulk-sending {
  padding: 20px;
  // min-height: calc(100vh - 40px);

  .operation-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;

    .expired-tip {
      color: #f56c6c;
      font-size: 14px;
      margin-left: 12px;
    }
  }

  .main-content {
    display: flex;
    gap: 20px;
    min-height: 0;

    .table-section {
      flex: 1;
      background: #fff;
      padding: 20px;
      border-radius: 4px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
      overflow: auto;
      display: flex;
      flex-direction: column;
      gap: 20px;

      .operation-section {
        display: flex;
        gap: 10px;
      }

      .custom-table {
        :deep(.el-table__header) {
          th {
            background-color: #f5f7fa;
            color: #606266;
            font-weight: 600;
          }
        }

        :deep(.el-table__row) {
          &:hover {
            td {
              background-color: #f5f7fa;
            }
          }
        }
      }
    }

    .preview-section {
      width: 400px;
      background: #fff;
      border-radius: 4px;
      box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
      display: flex;
      flex-direction: column;

      .preview-header {
        padding: 15px;
        border-bottom: 1px solid #eee;

        h3 {
          margin: 0;
          font-size: 16px;
        }
      }

      .preview-content {
        flex: 1;
        padding: 15px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 20px;

        .preview-block {
          .preview-title {
            font-size: 14px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #333;
          }

          .preview-material {
            background: #f5f5f5;
            padding: 15px;
            border-radius: 4px;

            .material-content {
              font-size: 14px;
              color: #333;
              margin-bottom: 10px;
              white-space: pre-wrap;
            }

            .material-time {
              font-size: 12px;
              color: #999;
            }
          }

          .preview-targets {
            .target-group {
              margin-bottom: 10px;

              .target-label {
                font-size: 14px;
                color: #666;
                margin-bottom: 5px;
              }

              .target-list {
                display: flex;
                flex-wrap: wrap;
                gap: 5px;

                .target-item {
                  margin-right: 5px;
                  margin-bottom: 5px;
                }
              }
            }
          }
        }
      }
    }
  }

  .pagination-section {
    display: flex;
    justify-content: flex-end;
    padding: 10px 0;
  }

  .task-dialog {
    :deep(.el-dialog__body) {
      padding: 0;
    }

    :deep(.el-dialog__header) {
      margin: 0;
      padding: 20px;
      border-bottom: 1px solid #ebeef5;
      background: #f5f7fa;
    }

    :deep(.el-dialog__title) {
      font-size: 18px;
      font-weight: 500;
      color: #303133;
    }

    :deep(.el-dialog__headerbtn) {
      top: 20px;
    }

    &-send {
      :deep(.el-form-item__content) {
        display: block;
      }
    }

    .task-form {
      padding: 0 24px;
      background: #fff;

      .el-form-item {
        margin-bottom: 10px;

        &:last-child {
          margin-bottom: 0;
        }

        :deep(.el-form-item__label) {
          font-weight: 500;
          color: #303133;
          padding-right: 16px;
        }

        :deep(.el-form-item__content) {
          .el-input__wrapper,
          .el-textarea__inner {
            box-shadow: 0 0 0 1px #dcdfe6 inset;
            transition: all 0.3s;

            &:hover {
              box-shadow: 0 0 0 1px #c0c4cc inset;
            }

            &:focus {
              box-shadow: 0 0 0 1px #409eff inset;
            }
          }
        }
      }

      .material-section {
        .material-options {
          display: flex;
          gap: 24px;
          align-items: center;

          .el-radio-group {
            display: flex;
            gap: 24px;

            :deep(.el-radio) {
              margin-right: 13px;
            }
          }

          .el-date-picker {
            width: 240px;
          }
        }
      }

      .target-section {
        .target-actions {
          margin-bottom: 10px;
          display: flex;
          gap: 12px;

          .el-button {
            padding: 8px 16px;
          }
        }

        .target-preview {
          background: #f5f7fa;
          padding: 10px 16px;
          border-radius: 8px;
          border: 1px solid #e4e7ed;
          margin: 10px 0;

          .target-group {
            margin-bottom: 5px;

            &:last-child {
              margin-bottom: 0;
            }

            .target-label {
              font-size: 14px;
              color: #606266;
              margin-bottom: 0px;
              font-weight: 500;
            }

            .target-list {
              display: flex;
              flex-wrap: wrap;
              gap: 8px;

              .target-item {
                margin: 0;
                padding: 0 8px;
                height: 28px;
                line-height: 26px;
                border-radius: 4px;
                background: #fff;
                border: 1px solid #dcdfe6;
                color: #606266;
                transition: all 0.3s;

                &:hover {
                  border-color: #409eff;
                  color: #409eff;
                }

                .el-icon {
                  margin-left: 4px;
                  font-size: 12px;
                }
              }
            }
          }
        }
      }
    }

    .selectSend {
      margin: 0;
      border-radius: 0;
      box-shadow: none;
      padding: 0 24px;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      margin-top: 24px;

      .section-title {
        font-size: 16px;
        font-weight: 500;
        color: #303133;
        margin-bottom: 20px;
        padding-left: 12px;
        border-left: 4px solid #409eff;
      }

      .message-tabs {
        :deep(.el-tabs__header) {
          margin-bottom: 24px;
        }

        :deep(.el-tabs__nav) {
          border: none;
        }

        :deep(.el-tabs__item) {
          height: 40px;
          line-height: 40px;
          font-size: 14px;
          color: #606266;
          padding: 0 20px;

          &.is-active {
            color: #409eff;
            font-weight: 500;
          }
        }

        .el-form-item {
          margin-bottom: 24px;

          &:last-child {
            margin-bottom: 0;
          }

          :deep(.el-form-item__label) {
            font-weight: 500;
            color: #303133;
          }
        }

        .image-uploader,
        .video-uploader,
        .miniprogram-image-uploader {
          border: 1px dashed #d9d9d9;
          border-radius: 8px;
          cursor: pointer;
          position: relative;
          overflow: hidden;
          width: 120px;
          height: 120px;
          display: flex;
          justify-content: center;
          align-items: center;
          transition: all 0.3s;

          &:hover {
            border-color: #409eff;
            background: #f5f7fa;
          }

          .upload-icon {
            font-size: 28px;
            color: #8c939d;
            transition: all 0.3s;
          }

          &:hover .upload-icon {
            color: #409eff;
          }

          .preview-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
          }

          .preview-video {
            width: 100%;
            max-height: 178px;
          }
        }
      }

      .message-actions {
        margin-top: 10px;
        display: flex;
        justify-content: flex-end;
      }

      .message-preview-item-list {
        flex: 1;
        padding-right: 10px;
        padding: 10px;
        height: 90%;
        overflow: hidden;
        &::-webkit-scrollbar {
          width: 6px;
        }
        &::-webkit-scrollbar-thumb {
          background-color: #c0c4cc;
          border-radius: 3px;
        }
        &::-webkit-scrollbar-track {
          background-color: #f5f7fa;
        }
        .preview-title {
          font-size: 16px;
          font-weight: bold;
          margin-bottom: 10px;
          color: #303133;
        }
        .message-preview-item-list {
          overflow-y: auto;
          padding-right: 10px;
          padding: 10px;
          &::-webkit-scrollbar {
            width: 6px;
          }
          &::-webkit-scrollbar-thumb {
            background-color: #c0c4cc;
            border-radius: 3px;
          }
          &::-webkit-scrollbar-track {
            background-color: #f5f7fa;
          }
        }
        .message-preview-item {
          margin-bottom: 5px;
          transition: all 0.3s;
          border: 1px solid #ebeef5;
          border-radius: 8px;
          overflow: hidden;
          :deep(.el-card__body) {
            padding: 10px !important;
          }
          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
          }

          .preview-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: 16px;

            .message-info {
              flex: 1;
              display: flex;
              align-items: flex-start;
              gap: 12px;

              .message-type-tag {
                padding: 4px 8px;
                border-radius: 4px;
                font-size: 12px;
                font-weight: 500;
                white-space: nowrap;
                flex-shrink: 0;

                &.text {
                  background-color: #e6f7ff;
                  color: #1890ff;
                }

                &.image {
                  background-color: #f6ffed;
                  color: #52c41a;
                }

                &.video {
                  background-color: #fff7e6;
                  color: #fa8c16;
                }

                &.link {
                  background-color: #f9f0ff;
                  color: #722ed1;
                }

                &.miniprogram {
                  background-color: #fff1f0;
                  color: #f5222d;
                }
              }

              .message-content {
                flex: 1;
                min-width: 0;
                font-size: 14px;
                color: #606266;
                word-break: break-all;
                white-space: pre-wrap;
                line-height: 2;
                .preview-image {
                  max-width: 100px;
                  max-height: 100px;
                  border-radius: 8px;
                  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
                }
                .preview-video {
                  max-width: 100px;
                  max-height: 100px;
                  border-radius: 8px;
                  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
                }
              }
            }

            .preview-actions {
              flex-shrink: 0;

              .action-buttons {
                display: flex;
                gap: 8px;
                align-items: center;

                .el-button {
                  padding: 4px;

                  &.is-disabled {
                    opacity: 0.5;
                    cursor: not-allowed;
                  }

                  .el-icon {
                    font-size: 16px;
                  }
                }
              }
            }
          }
        }
      }
    }

    .dialog-footer {
      padding: 10px 24px;
      border-top: 1px solid #ebeef5;
      display: flex;
      justify-content: flex-end;
      gap: 12px;

      .el-button {
        padding: 8px 20px;
      }
    }
  }

  .friend-selector,
  .group-selector {
    .search-wrapper {
      margin-bottom: 16px;

      .search-input {
        :deep(.el-input-group__append) {
          padding: 0;
          background-color: #409eff;
          border-color: #409eff;

          .el-button {
            margin: 0;
            border: none;
            color: #fff;
            padding: 0 15px;
            height: 32px;

            &:hover {
              background-color: #66b1ff;
            }

            .el-icon {
              margin-right: 4px;
            }
          }
        }
      }
    }

    .el-table {
      margin-top: 16px;
    }
  }
}

.image-uploader {
  width: 100px;
  height: 100px;
  border: 1px dashed #d9d9d9;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: all 0.3s;

  &:hover {
    border-color: #409eff;
    background: #f5f7fa;
  }

  .upload-icon {
    font-size: 28px;
    color: #8c939d;
    transition: all 0.3s;
  }

  &:hover .upload-icon {
    color: #409eff;
  }

  .preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

:deep(.el-upload--picture-card) {
  width: 100px;
  height: 100px;
  line-height: 100px;
}

:deep(.el-upload-list--picture-card .el-upload-list__item) {
  width: 100px;
  height: 100px;
}

:deep(.el-overlay) {
  .task-dialog {
    --el-dialog-margin-top: 1vh !important;
  }
}

.message-content {
  .message-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;

    .message-type {
      margin-right: 8px;
    }

    .message-data {
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }
}

.target-info {
  .target-group {
    .target-label {
      font-size: 12px;
      color: #666;
      margin-bottom: 4px;
    }

    .target-list {
      display: flex;
      flex-wrap: wrap;
      gap: 4px;
      align-items: center;
      .target-item {
        margin-right: 4px;
      }
    }
  }
}

.create-info {
  font-size: 12px;
  color: #666;

  div {
    margin-bottom: 4px;
  }
}

.message-types {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;

  .message-type-tag {
    margin: 2px;
  }
}

.message-type-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;

  .message-type-tag {
    margin: 2px;
  }
}

.target-item {
  &.is-disabled {
    background-color: #f5f7fa;
    border-color: #e4e7ed;
    color: #c0c4cc;
    cursor: not-allowed;

    &:hover {
      border-color: #e4e7ed;
      color: #c0c4cc;
    }
  }
}

:deep(.el-overlay) {
  .message-preview-dialog {
    --el-dialog-margin-top: 5vh !important;
    height: 80vh;
    .el-dialog__body {
      flex: 1;
      overflow: hidden;
      padding: 24px;
      background: #f6f8fa;
      height: calc(80vh - 120px) !important;
    }
  }
}

.message-preview-dialog {
  :deep(.el-dialog) {
    max-height: 80vh !important;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  }

  :deep(.el-dialog__header) {
    margin: 0;
    padding: 20px 24px;
    border-bottom: 1px solid #ebeef5;
    background: #f5f7fa;
    flex-shrink: 0;

    .el-dialog__title {
      font-size: 18px;
      font-weight: 600;
      color: #303133;
    }
  }
  .message-preview-container {
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;

    &::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background-color: #c0c4cc;
      border-radius: 3px;
    }

    &::-webkit-scrollbar-track {
      background-color: #f5f7fa;
    }

    .message-preview-item-list {
      display: flex;
      flex-direction: column;
      gap: 16px;
      padding: 4px;
      min-height: 100%;
    }
  }
}

.message-preview-item {
  transition: all 0.3s ease;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  background: #ffffff;

  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  :deep(.el-card__body) {
    padding: 16px !important;
  }

  .preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;

    .message-info {
      flex: 1;
      display: flex;
      align-items: flex-start;
      gap: 12px;

      .message-type-tag {
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        flex-shrink: 0;

        &.text {
          background-color: #e6f7ff;
          color: #1890ff;
        }

        &.image {
          background-color: #f6ffed;
          color: #52c41a;
        }

        &.video {
          background-color: #fff7e6;
          color: #fa8c16;
        }

        &.link {
          background-color: #f9f0ff;
          color: #722ed1;
        }

        &.miniprogram {
          background-color: #fff1f0;
          color: #f5222d;
        }
      }

      .message-content {
        flex: 1;
        min-width: 0;
        font-size: 14px;
        color: #606266;
        word-break: break-all;
        white-space: pre-wrap;
        line-height: 1.6;

        .preview-image {
          max-width: 200px;
          max-height: 200px;
          border-radius: 8px;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .preview-video {
          max-width: 300px;
          max-height: 200px;
          border-radius: 8px;
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .link-preview {
          background: #f8fafc;
          border-radius: 8px;
          padding: 16px;
          border: 1px solid #eef2f6;

          .link-title {
            font-weight: 600;
            color: #2c3e50;
            margin-bottom: 8px;
            font-size: 15px;
          }

          .link-url {
            color: #3b82f6;
            font-size: 13px;
            margin-bottom: 8px;
            word-break: break-all;
          }

          .link-desc {
            color: #64748b;
            font-size: 13px;
            line-height: 1.5;
          }
        }

        .miniprogram-preview {
          background: #f8fafc;
          border-radius: 8px;
          padding: 16px;
          border: 1px solid #eef2f6;

          .preview-image {
            width: 100%;
            height: 160px;
            object-fit: cover;
            margin-bottom: 12px;
            border-radius: 6px;
          }

          .miniprogram-title {
            font-weight: 600;
            color: #2c3e50;
            margin-bottom: 8px;
            font-size: 15px;
          }

          .miniprogram-path {
            color: #64748b;
            font-size: 13px;
            line-height: 1.5;
          }
        }
      }
    }

    .preview-actions {
      flex-shrink: 0;

      .action-buttons {
        display: flex;
        gap: 8px;
        align-items: center;

        .el-button {
          padding: 6px;
          border-radius: 4px;
          transition: all 0.3s;

          &:hover {
            background-color: #f5f7fa;
          }

          &.is-disabled {
            opacity: 0.5;
            cursor: not-allowed;
          }

          .el-icon {
            font-size: 16px;
          }
        }
      }
    }
  }
}

.preview-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #303133;

  .el-button {
    padding: 4px;

    .el-icon {
      font-size: 18px;
    }
  }
}
.content-item {
  :deep(.el-form-item__content) {
    display: block;
  }
  .content-input-wrapper {
    position: relative;
    .emoji-trigger {
      position: absolute;
      right: 8px;
      top: 8px;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      border-radius: 4px;
      transition: all 0.3s;
      z-index: 2;

      &:hover {
        background-color: #f5f7fa;
      }

      .emoji-icon {
        font-size: 20px;
        color: #606266;
      }
    }
    .emoji-picker-container {
      background: #fff;
      border-radius: 8px;
      width: 350px;
      height: 400px;
      .emoji-picker {
        margin: 0;
        height: 100%;
        width: 100%;
      }
    }
  }
}
